package com.xian.steleinfo.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xian.common.annotation.Log;
import com.xian.common.core.controller.BaseController;
import com.xian.common.core.domain.AjaxResult;
import com.xian.common.enums.BusinessType;
import com.xian.steleinfo.domain.Steleinfo;
import com.xian.steleinfo.service.ISteleinfoService;
import com.xian.common.utils.poi.ExcelUtil;
import com.xian.common.core.page.TableDataInfo;

/**
 * 碑文管理Controller
 * 
 * @author ruoyi
 * @date 2025-04-11
 */
@RestController
@RequestMapping("/steleinfo/steleinfo")
public class SteleinfoController extends BaseController
{
    @Autowired
    private ISteleinfoService steleinfoService;

    /**
     * 查询碑文管理列表
     */
    @PreAuthorize("@ss.hasPermi('steleinfo:steleinfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(Steleinfo steleinfo)
    {
        startPage();
        List<Steleinfo> list = steleinfoService.selectSteleinfoList(steleinfo);
        return getDataTable(list);
    }

    /**
     * 导出碑文管理列表
     */
    @PreAuthorize("@ss.hasPermi('steleinfo:steleinfo:export')")
    @Log(title = "碑文管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Steleinfo steleinfo)
    {
        List<Steleinfo> list = steleinfoService.selectSteleinfoList(steleinfo);
        ExcelUtil<Steleinfo> util = new ExcelUtil<Steleinfo>(Steleinfo.class);
        util.exportExcel(response, list, "碑文管理数据");
    }

    /**
     * 获取碑文管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('steleinfo:steleinfo:query')")
    @GetMapping(value = "/{SteleID}")
    public AjaxResult getInfo(@PathVariable("SteleID") Long SteleID)
    {
        return success(steleinfoService.selectSteleinfoBySteleID(SteleID));
    }

    /**
     * 新增碑文管理
     */
    @PreAuthorize("@ss.hasPermi('steleinfo:steleinfo:add')")
    @Log(title = "碑文管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Steleinfo steleinfo)
    {
        return toAjax(steleinfoService.insertSteleinfo(steleinfo));
    }

    /**
     * 修改碑文管理
     */
    @PreAuthorize("@ss.hasPermi('steleinfo:steleinfo:edit')")
    @Log(title = "碑文管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Steleinfo steleinfo)
    {
        return toAjax(steleinfoService.updateSteleinfo(steleinfo));
    }

    /**
     * 删除碑文管理
     */
    @PreAuthorize("@ss.hasPermi('steleinfo:steleinfo:remove')")
    @Log(title = "碑文管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{SteleIDs}")
    public AjaxResult remove(@PathVariable Long[] SteleIDs)
    {
        return toAjax(steleinfoService.deleteSteleinfoBySteleIDs(SteleIDs));
    }
}
